package com.woniuxy.article.controller;

import com.hc.entity.Comment;
import com.hc.utils.ResponseEntity;
import com.woniuxy.article.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description：
 * @Author：曹杰克
 * @CreateTime：2022/10/20 15:50
 */
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    CommentService commentService;
    @RequestMapping("/add")
    public ResponseEntity addComment(@RequestBody Comment commnet){
        commentService.addComment(commnet);
        return ResponseEntity.SUCCESS;

    }
    @PostMapping("/agree")
    public ResponseEntity  updateAgreenum(@RequestBody Comment commnet){
        commentService.updateAgreenum(commnet);
        return ResponseEntity.SUCCESS;

    }
    @PostMapping("/disagree")
    public ResponseEntity updatedisAgreenum( @RequestBody Comment commnet){
        commentService.updatedisAgreenum(commnet);
        return ResponseEntity.SUCCESS;

    }
    @PostMapping("/settop")
    public ResponseEntity  setTop(@RequestBody Comment commnet){
        commentService.setTop(commnet);
        return ResponseEntity.SUCCESS;
    }
}
